package com.zhong.system.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhong.common.utils.WrapperUtils;
import com.zhong.system.domain.SysOperLog;
import com.zhong.system.mapper.SysOperLogMapper;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 操作日志 服务层处理
 *
 * @author zhongzc
 */
@Service
public class SysOperLogService extends ServiceImpl<SysOperLogMapper, SysOperLog>
{

    public Page<SysOperLog> findPage(SysOperLog operLog){
        return page(operLog.getPage(),WrapperUtils.getLambdaQueryWrapper(operLog));
    }

    /**
     * 新增操作日志
     *
     * @param operLog 操作日志对象
     */
    public void insertOperlog(SysOperLog operLog)
    {
       save(operLog);
    }

    /**
     * 查询系统操作日志集合
     *
     * @param operLog 操作日志对象
     * @return 操作日志集合
     */
    public List<SysOperLog> selectOperLogList(SysOperLog operLog)
    {
        return list(WrapperUtils.getLambdaQueryWrapper(operLog));
    }

    /**
     * 批量删除系统操作日志
     *
     * @param ids 需要删除的操作日志ID
     * @return 结果
     */
    public void deleteByIds(String[] ids)
    {
        removeByIds(Arrays.asList(ids));
    }

    /**
     * 清空操作日志
     */
    public void clean()
    {
        baseMapper.clean();
    }
}
